﻿package controller {
	import ApplicationFacade;	
	import model.*;
	import view.ApplicationMediator;
	
	import flash.display.Stage;
	import org.puremvc.as3.interfaces.INotification;	
	import org.puremvc.as3.patterns.command.SimpleCommand;
	import org.puremvc.as3.interfaces.ICommand;

	/**
	 * @author Aleksey Lobanov
	 * Create and register proxies and mediators
	 */
	public class StartupCommand extends SimpleCommand implements ICommand {
		
		override public function execute(note : INotification) : void {
							
			// body of notification is our Main movieclip
			var stage:Stage = note.getBody().stage as Stage;
			
			/**
			 * register proxy
			 * all events in this proxy
			 */
			facade.registerProxy( new StageProxy(stage) );
			  
            //controll first run application
            facade.registerMediator( new ApplicationMediator(new Object) );               
		}
	}
}
